package com.example.layoutmodule

import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import kotlinx.android.synthetic.main.activity_main.*

class MainActivity : AppCompatActivity(), View.OnClickListener {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        btn_main_relative_layout.setOnClickListener(this)
        btn_main_listview_layout.setOnClickListener(this)
        btn_main_recyclerview_layout.setOnClickListener(this)
    }

    override fun onClick(v: View?) {
//        TODO("Not yet implemented")
        when(v?.id){
            R.id.btn_main_relative_layout->{
                //启动RelativeLayout的布局
                startActivity(Intent(this,RelativeLayoutActivity::class.java))

            }

            R.id.btn_main_listview_layout->{
                //启动ListView布局
                startActivity(Intent(this,ListViewActivity::class.java))
            }

            R.id.btn_main_recyclerview_layout->{
                //启动RecyclerView布局
                startActivity(Intent(this,RecyclerViewActivity::class.java))
            }
        }
    }
}